extends MarginContainer

@onready var bk = $BK
@onready var sto_item : MarginContainer= $Sto_Item

signal selected
signal choiced
# Called when the node enters the scene tree for the first time.
func _ready():
	gui_input.connect(mouse_select)
	pass # Replace with function body.


var item :Item = null : set = _set_item


func _set_item(value : Item):
	item = value
	if item == null:
		print("set item error,item is null")
		return
	sto_item.update_display(item)

func mouse_select(event:InputEvent):
	if event is InputEventMouseButton and event.is_pressed():
		if event.button_index == MOUSE_BUTTON_LEFT:
			selected.emit()
		if event.button_index == MOUSE_BUTTON_RIGHT:
			choiced.emit()

func _on_mouse_entered():
	bk.modulate = Color.BISQUE


func _on_mouse_exited():
	bk.modulate = Color.WHITE

